package top.glike.ssl.auto.utils;

import lombok.Data;

/**
 * packageName top.glike.ssl.auto.utils
 *
 * @author Sophia
 * @className CommandResult
 * @description TODO
 * @date 2025/10/13
 */
@Data
public class CommandResult {
    private boolean success;
    private String output;
    private String error;
    private int exitStatus;
    private long executionTime;

    public static CommandResult success(String output, long executionTime) {
        CommandResult result = new CommandResult();
        result.setSuccess(true);
        result.setOutput(output);
        result.setExitStatus(0);
        result.setExecutionTime(executionTime);
        return result;
    }

    public static CommandResult failure(String error, int exitStatus, long executionTime) {
        CommandResult result = new CommandResult();
        result.setSuccess(false);
        result.setError(error);
        result.setExitStatus(exitStatus);
        result.setExecutionTime(executionTime);
        return result;
    }
}
